﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using NewDDSys.Entity;
using NewDDSys.IBLL;
using NewDDSys.IDAL;
using NewDDSys.Factory;
using NewDDSys.Utility;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class Web_Jddx : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        btnOK.Attributes.Add("onclick", "javascript:if(confirm('" + "确认无误，并提交么？" + "')== false) return false;");
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        int checkValue = 0;
        JddxInfo dx = new JddxInfo();
        dx.Jday = DateTime.Now.ToString();
        string nowtime = DateTime.Now.ToShortTimeString().ToString();
        string time1 = "08:00:00";
        string time2 = "20:00:00";
        DateTime dt1 = Convert.ToDateTime(nowtime);
        DateTime dt2 = Convert.ToDateTime(time1);
        DateTime dt3 = Convert.ToDateTime(time2);
        if (DateTime.Compare(dt1, dt2) < 0 || DateTime.Compare(dt1, dt3) > 0)
        {
            dx.Banbie = "夜";
        }
        else
            dx.Banbie = "白";
        
        
        dx.Banzu = ddlBanzu.SelectedValue.ToString();
        dx.Tianbao = Session["用户信息.姓名"].ToString();
        dx.Kn = Convert.ToDecimal(txtKN.Text.ToString());
        dx.Kw = Convert.ToDecimal(txtKW.Text.ToString());
        dx.Zn = Convert.ToDecimal(txtZN.Text.ToString());
        dx.Hx = Convert.ToDecimal(txtHx.Text.ToString());
        dx.Num = BLLFactory.CreateJddxBLL().AUTOID();
        checkValue = BLLFactory.CreateJddxBLL().AddJddx(dx);
        if (checkValue >= 1)
        {
            Response.Write(" <script   language=javascript> window.alert( ' 提交成功！ ');</script> ");
        }
        Response.Redirect("DXJL.aspx");
    }
    protected void btnRepeat_Click(object sender, EventArgs e)
    {
        
        ddlBanzu.SelectedIndex = 0;
        txtKN.Text = "";
        txtKW.Text = "";
        txtZN.Text = "";
    }
}
